#define _GUN_SOURCE
#include <pthread.h>
#include "log.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/syscall.h>


void *thread_func01(void *arg)
{
    while (1)
    {
        log_info("thread_func01:%d",gettid());
        sleep(1);
    }
}
void *thread_func02(void *arg)
{
    int i = 0;
    while (i < 20)
    {
        i++;
        log_info("thread_func02:%d",gettid());
        sleep(1);
    }
    return NULL;
}

int main()
{
    pthread_t thread01;
    pthread_t thread02;

    pthread_create(&thread01, NULL, thread_func01, NULL);
    pthread_create(&thread02, NULL, thread_func02, NULL);

    sleep(10);

    pthread_cancel(thread01);
    pthread_join(thread02, NULL);
    log_info("main thread exit\n");
    return 0;
}